//
//  TicketRecordDetailVc.m
//  Shengzhuli
//
//  Created by FXGuo on 2018/2/12.
//  Copyright © 2018年 kamangkeji. All rights reserved.
//

#import "TicketRecordDetailVc.h"

@interface TicketRecordDetailVc ()

@property (weak, nonatomic) IBOutlet UILabel *nameLab;
@property (weak, nonatomic) IBOutlet UILabel *countLab;
@property (weak, nonatomic) IBOutlet UILabel *priceLab;
@property (weak, nonatomic) IBOutlet UILabel *timeLab;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *HeightCons;

@end

@implementation TicketRecordDetailVc

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"使用详情";
    self.view.backgroundColor = RGBColor(238, 238, 244);
    self.nameLab.text = [NSString stringWithFormat:@"活动名称:%@",self.model.clubCommodityName];
    self.countLab.text = [NSString stringWithFormat:@"参加人数:%zd",self.model.personNum];
    self.priceLab.text = [NSString stringWithFormat:@"消费金额:%zd元",self.model.price];
    self.timeLab.text = [NSString stringWithFormat:@"使用时间:%@",[self spToDateString:self.model.tripDate]];
    self.HeightCons.constant = [[NSString stringWithFormat:@"活动名称:%@",self.model.clubCommodityName] boundingRectWithSize:CGSizeMake(ScreenW-60, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:Font(16)} context:nil].size.height + 130;
}

- (NSString *)spToDateString:(NSString *)sp
{
    NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
    [formatter setDateStyle:NSDateFormatterMediumStyle];
    [formatter setTimeStyle:NSDateFormatterShortStyle];
    formatter.dateFormat = @"YYYY年MM月dd日";
    
    NSDate *timeDate = [NSDate dateWithTimeIntervalSince1970:[sp floatValue]/1000];
    return [formatter stringFromDate:timeDate];
}

@end
